package lab02.test23;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;
import java.util.logging.SimpleFormatter;

public class Test {
    public static void main(String[] args) throws ParseException {
        //生日信息：19981101
        String birthday;

        Scanner scanner=new Scanner(System.in);

        System.out.println("Please input your birthday: ");
        birthday=scanner.nextLine();

        System.out.println(birthday);

        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");

        //关于日期的计算,计算你的生日还有多少
        Calendar calendar= Calendar.getInstance();

        calendar.setTime(sdf.parse(birthday));
        long time1=calendar.getTimeInMillis();

        calendar.setTime(sdf.parse("2017-11-02"));
        long time2=calendar.getTimeInMillis();

        System.out.println("天数: "+(time1-time2)/(24*60*60*1000));

        //time1生日
        //time2当前日期
        //1秒=1000毫秒
        //（time1-time2）/（）




    }
}
